//导入express
const express = require("express");
const {getUserInfo, updateUserInfo, updateUserPwd, updateAvatar} = require("../router-handler/userInfo");
//导入express-joi模块
const expressJoi = require("@escook/express-joi");
//导入校验规则
const {update_userInfo_schema, pwd_schema, avatar_schema} = require("../schema/user");

//创建Router实例
const router = express.Router();

//定义获取用户信息接口
router.get("/userinfo", getUserInfo)

//定义更新用户信息接口 调用expressJoi()方法 校验req.body的数据
router.post("/updateUserInfo", expressJoi(update_userInfo_schema), updateUserInfo)

//定义修改用户密码接口
router.post("/updatePwd", expressJoi(pwd_schema), updateUserPwd)

//定义修改头像
router.post("/updateAvatar", expressJoi(avatar_schema), updateAvatar)

//导出路由
module.exports = router;
